-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Primes #7
Primes #7
Conversation
Prime numbers are an essential building block of many algorithms in diverse areas such as cryptography, digital communications and many others. This module adds a function to generate lists of primes upto a certain value. For now it just adds
This is faster than first calculating the primes of an integer number and then converting the result to a tensor of floats. For large `upto` numbers the difference is substantial.
This new function returns a Tensor containing the prime factors of the input.
Single element and element-wise functions that return true when their inputs are prime numbers.
This should be in a number-theory repo I think? |
Prime number generation and checking are quite common in signal processing and digital communications. For example, primes are used to generate sequences such as Zadoff-Chu which are used in all sorts of context in 5G cellular systems (e.g. to generate sync and reference signals, random access and to transmit control information). I agree that these could perhaps be put in a separate repo, along with procedures to generate bessel functions, etc., but then impulse would end up having to reference that separate repo (e.g. bessel functions are required to the Kaiser filter windows that I added in the other PR I recently sent: #6). So, for now, I would just keep them all in impulse (which is still kind of empty anyway) as I don't intend to add many more of these beyond what's strictly needed to add more signal processing capabilities to impulse. If these grow much beyond that scope, we could split them up into their own repo later. What do you think? |
We have the https://github.com/SciNim/scinim repo, which could be another alternative. In general though in the current Nim landscape I think fewer, but larger repos are better than many tiny ones for discoverability. |
I just made SciNim/scinim#16 to add this code to the scinim repo rather than to impulse. |
As it's part of |
This PR adds a few prime related functions:
These can be used in a number of digital communications and cryptography related algorithms.